#!/usr/bin/python
# -*- coding: utf-8 -*-

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from gui.ui_quizdialog import Ui_Dialog

class QuizDialog(QDialog, Ui_Dialog):
	def __init__(self, parent = None, nquestions = 10, **kwargs):
		super(QuizDialog, self).__init__(parent)
		self.setupUi(self)
		self.curquestion, self.nquestions = 0, nquestions

		for w in (self.pushButtonYes, self.pushButtonNo):
			self.connect(w, SIGNAL("clicked()"), lambda:self.ClickAnswerButton(w))

	
	def ClickAnswerButton(self, button):
		self.curquestion += 1
		if self.curquestion == self.nquestions:
			self.accept()

		self.qlabel.setText(u"Question №%d:" % (self.curquestion + 1))
		self.textBrowser.setText(u"hello "*(self.curquestion + 1))



